from lxml import etree

import re

maven_version_pattern = r'^(\d+\.\d+\.\d+|\d+\.\d+|\d+:\d+\.\d+\.\d+)$'

maven_remove_version_pattern = r'\w+:\w+(:\d+\.\d+\.\d+)'

# 示例字符串
dep = '1:1.6.0'

if re.match(maven_version_pattern, dep.strip()):
    print('excluded!')
else:
    rpm_name_cleaned = dep.strip(',"\',').strip()
    match = re.match(maven_remove_version_pattern, dep.strip())
    if match:
        version = match.group(1)
        rpm_name_cleaned = rpm_name_cleaned.replace(version, '')
    print(f'output:{rpm_name_cleaned}!')
